<?php
namespace app\index\controller;
use app\common\exception\System as SystemException;
use Exception;
use app\index\model\Imgtext;
use app\index\model\Video as Videos;
use app\index\model\Friend;
use app\index\model\Smallvideo;
use app\index\model\Comment;
use app\index\model\Newsfollow;
use app\index\model\Newscollect;
use app\index\model\Newspraise;
class Homepage extends Common
{
        /**
         * 不需要登录
         * @var array
         */
        protected $noNeedLogin = ['*'];
        /**
         * 新闻首页
         * @return [type] [description]
         */

        public function index(){
            $news=Imgtext::field('id,member_id,title,thumb,create_time')->order("create_time desc")->limit(3)->select()->toArray();
            $video=Videos::field("id,member_id,title,type,url,thumb")->order("create_time desc")->limit(1)->select()->toArray();
            $friend= Friend::with('Members')->field("id,member_id,thumb,nickname,sex,hobby,birth")->order("create_time desc")->limit(3)->select()->toArray();
          	$arr=["status"=>1,"news"=>$news,"video"=>$video,"friend"=>$friend,"msg"=>"获取成功"];
  			return $this->successReturn($arr,SystemException::E_SUCCESS,$arr['msg']);
        }
}